package models;

import java.sql.ResultSet;
import java.sql.SQLException;

public class 
SupplierModel 
extends AbstractModel
{	public boolean insert(String supName, String address, String city, String status)
	{	
		try
		{
			ps = con.prepareStatement("INSERT INTO Supplier VALUES (?,?,?,?)");
			ps.setString(1, supName);
			ps.setString(2, address);
			ps.setString(3, city);
			ps.setString(4, status.toUpperCase());
			return wrapUp();
			
		} 
		catch(SQLException ex)
		{ 
			return registerException(ex); 
		}
	}
	
	public boolean delete(String supName)
	{ 	
		try
		{
			ps = con.prepareStatement("DELETE FROM Supplier WHERE supName = ?");
			ps.setString(1, supName);
			return wrapUp();
		} 
		catch(SQLException ex)
		{ 
			return registerException(ex); 
		}
	}
	
	public ResultSet show()
	{ 
		return super.show("Supplier"); 
	}
}
